package com.dianping.cat.consumer.storage.model.entity;

import com.dianping.cat.consumer.storage.model.BaseEntity;
import com.dianping.cat.consumer.storage.model.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;









public class Operation
  extends BaseEntity<Operation>
{
  private String m_id;
  private long m_count;
  private double m_avg;
  private double m_sum;
  private long m_error;
  private long m_longCount;
  private Map<Integer, Segment> m_segments = new LinkedHashMap();





  public Operation(String id) { this.m_id = id; }




  public void accept(IVisitor visitor) { visitor.visitOperation(this); }


  public Operation addSegment(Segment segment) {
/*  40 */     this.m_segments.put(Integer.valueOf(segment.getId()), segment);
/*  41 */     return this;
  }


  public boolean equals(Object obj) {
/*  46 */     if (obj instanceof Operation) {
/*  47 */       Operation _o = (Operation)obj;

/*  49 */       if (!equals(getId(), _o.getId())) {
/*  50 */         return false;
      }

/*  53 */       return true;
    }

/*  56 */     return false;
  }


/*  60 */   public Segment findSegment(int id) { return (Segment)this.m_segments.get(Integer.valueOf(id)); }


  public Segment findOrCreateSegment(int id) {
/*  64 */     Segment segment = (Segment)this.m_segments.get(Integer.valueOf(id));

/*  66 */     if (segment == null) {
/*  67 */       synchronized (this.m_segments) {
/*  68 */         segment = (Segment)this.m_segments.get(Integer.valueOf(id));

/*  70 */         if (segment == null) {
/*  71 */           segment = new Segment(id);
/*  72 */           this.m_segments.put(Integer.valueOf(id), segment);
        }
      }
    }

/*  77 */     return segment;
  }


/*  81 */   public double getAvg() { return this.m_avg; }



/*  85 */   public long getCount() { return this.m_count; }



/*  89 */   public long getError() { return this.m_error; }



/*  93 */   public String getId() { return this.m_id; }



/*  97 */   public long getLongCount() { return this.m_longCount; }



/* 101 */   public Map<Integer, Segment> getSegments() { return this.m_segments; }



/* 105 */   public double getSum() { return this.m_sum; }




  public Operation incCount() {
/* 118 */     this.m_count++;
/* 119 */     return this;
  }

  public Operation incCount(long count) {
/* 123 */     this.m_count += count;
/* 124 */     return this;
  }

  public Operation incError() {
/* 128 */     this.m_error++;
/* 129 */     return this;
  }

  public Operation incError(long error) {
/* 133 */     this.m_error += error;
/* 134 */     return this;
  }

  public Operation incLongCount() {
/* 138 */     this.m_longCount++;
/* 139 */     return this;
  }

  public Operation incLongCount(long longCount) {
/* 143 */     this.m_longCount += longCount;
/* 144 */     return this;
  }

  public Operation incSum() {
/* 148 */     this.m_sum++;
/* 149 */     return this;
  }

  public Operation incSum(double sum) {
/* 153 */     this.m_sum += sum;
/* 154 */     return this;
  }


  public void mergeAttributes(Operation other) {
/* 159 */     assertAttributeEquals(other, "operation", "id", this.m_id, other.getId());

/* 161 */     this.m_count = other.getCount();

/* 163 */     this.m_avg = other.getAvg();

/* 165 */     this.m_sum = other.getSum();

/* 167 */     this.m_error = other.getError();

/* 169 */     this.m_longCount = other.getLongCount();
  }


/* 173 */   public Segment removeSegment(int id) { return (Segment)this.m_segments.remove(Integer.valueOf(id)); }


  public Operation setAvg(double avg) {
/* 177 */     this.m_avg = avg;
/* 178 */     return this;
  }

  public Operation setCount(long count) {
/* 182 */     this.m_count = count;
/* 183 */     return this;
  }

  public Operation setError(long error) {
/* 187 */     this.m_error = error;
/* 188 */     return this;
  }

  public Operation setId(String id) {
/* 192 */     this.m_id = id;
/* 193 */     return this;
  }

  public Operation setLongCount(long longCount) {
/* 197 */     this.m_longCount = longCount;
/* 198 */     return this;
  }

  public Operation setSum(double sum) {
/* 202 */     this.m_sum = sum;
/* 203 */     return this;
  }

  public Operation() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/storage/model/entity/Operation.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */